Understand containment relationships and entity completion

Understand containment relationships and entity completion

When an entity is considered to be complete, the rule engine assumes that it knows about the entire set of instances for that entity. An entity's completion status (whether or not it is considered to be complete) is of major importance when determining whether or not a relationship is partially known. See Understand partial knowledge of relationships.

The completion status of an entity is determined by the engine through the use of containment relationships. A containment relationship is a one-to-many relationship from a parent entity to a child entity, and is created automatically when an entity instance is added, based on the entity and containment definition defined in the properties file for the rulebase. An entity Y is considered to be complete if:

  1. A one-to-many containment relationship is defined from some other entity X to entity Y. We say that Y is contained by X, and we refer to the relationship as entity Y's containment relationship.
  2. Entity Y's containment relationship is set (ie it is known) for all instances of entity X.
  3. Entity X is also considered to be complete.

 

NOTE: The global entity is always automatically complete. It is not necessary (or possible) to create a containment relationship for the global entity.

 

Consider the example provided in the following diagram:

In this scenario:

  1. The global entity is automatically complete.
  2. Entity X is complete. This is because its containment relationship from the global is known.
  3. Entity Y is complete. This is because its containment relationship is known for all instances of entity X, and entity X is complete.

 

Consider this second scenario:

In this scenario:

  1. The global entity is automatically complete.
  2. Entity X is complete. This is because its containment relationship from the global is known.
  3. Entity Y is not complete, because its containment relationship is not known for all instances of entity X.

 

Consider this third scenario:

In this scenario:

  1. The global entity is automatically complete.
  2. Entity X is not complete, as its containment relationship is not known.
  3. Entity Y is not complete, as entity X is not complete. This is the case even though entity Y's containment relationship is known for all instances of entity X.